package com.smarth.zhizulian.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.smarth.zhizulian.R;
import com.smarth.zhizulian.app.BaseActivity;
import com.smarth.zhizulian.app.BaseConfig;
import com.smarth.zhizulian.entity.EventBean;
import com.smarth.zhizulian.utils.UserUtils;

import org.simple.eventbus.EventBus;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by 18865 on 2017/12/22.
 */

public class SettingsActivity extends BaseActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_settings);
        ButterKnife.bind(this);
        setTitlebar("设置", true);
    }

    public static void open(Context context) {
        Intent i = new Intent(context, SettingsActivity.class);
        context.startActivity(i);
    }

    @OnClick({R.id.btn_logout, R.id.rl_us, R.id.rl_together, R.id.rl_agreement})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_logout:
                UserUtils.setToken("");
//                EventBus.getDefault().post(new EventBean(), BaseConfig.EventTag.ON_LOGOUT);
//                this.finish();
                MainActivity.openRestart(mContext);
                break;
            case R.id.rl_us:
                AboutUsActivity.open(mContext);
                break;
            case R.id.rl_together:
                AboutUsActivity.openForComeOn(mContext);
                break;
            case R.id.rl_agreement:
                AgentWebActivity.openForAgreement(mContext);
                break;
        }
    }

}
